package com.bs.service.impl;

import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.bs.bean.Manager;
import com.bs.dao.ManagerDAO;
import com.bs.service.ManagerService;

public class ManagerServiceImpl extends SqlMapClientDaoSupport implements ManagerService {

private ManagerDAO managerDao;
	
	public ManagerDAO getManagerDao() {
		return managerDao;
	}

	public void setManagerDao(ManagerDAO managerDao) {
		this.managerDao = managerDao;
	}

	@Override
	public void save(Manager manager) {
		this.managerDao.save(manager);
	}

	@Override
	public List<Manager> findAll() {
		return this.managerDao.findAll();
	}
	
	@Override
	public int batchDelete(String ids){
		return this.managerDao.batchDelete(ids);
	}

	@Override
	public void update(Manager manager) {
		this.managerDao.update(manager);
		
	}

	@Override
	public Manager login(Manager manager) {
		return this.managerDao.getManager(manager);
	}

	@Override
	public int changePwd(Manager manager, String newPassword) {
		Manager man = managerDao.getManager(manager);
		if(man == null)
			return -1;
		else{
			man.setPassword(newPassword);
			return managerDao.update(man);
		}
	}
	
	
	
}
